import {createRouter, createWebHistory} from 'vue-router'
import store from "@/store";

const routes = [
  {
    path: '/',
    name: '首页',
    component: () => import('../layout/index'),
    redirect:'/index',
    children:[
      {
        path:'/index',
        name:'首页',
        component: () => import('../views/index'),
      },
      {
        path: '/userCenter',
        name: '个人中心',
        component: () => import('../views/userCenter/index')
      },
      // {
      //   path:'/sys/user',
      //   component: ()=>import('@/views/sys/user/index')
      // }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  // {
  //   path: '/404',
  //   name: 'NotFound',
  //   component: () => import('../views/404.vue')
  // },
  // { path: "/:pathMatch(.*)", redirect: "/404", name: "notMatch", hidden: true },
]

// const dynamicRoutes = store.getters.GET_ROUTES;

const router = createRouter({
  // history: createWebHashHistory(),
  history: createWebHistory(),
  routes
  // routes: dynamicRoutes.length > 0 ? dynamicRoutes : routes
})

export default router
